package fr.iut.tp3.view.listeners;

import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

import javax.swing.JButton;

public class EnterKeyListener implements KeyListener {

	private JButton button;

	public EnterKeyListener(JButton button) {
		this.button = button;
	}

	@Override
	public void keyPressed(KeyEvent arg0) { }

	@Override
	public void keyReleased(KeyEvent arg0) { }

	@Override
	public void keyTyped(KeyEvent e) {
		if (e.getKeyChar() == '\n') {
			button.doClick();
		}
	}

}
